package com.huiminpay.transaction.service;

import com.huiminpay.common.cache.domain.BusinessException;
import com.huiminpay.transaction.api.dto.PayChannelDTO;
import com.huiminpay.transaction.api.dto.PayChannelParamDTO;
import com.huiminpay.transaction.api.dto.PlatformChannelDTO;

import java.util.List;

public interface IPayChannelService {
    /**
     * 查询平台支持的所有服务
     * @return
     */
    List<PlatformChannelDTO> queryPlatformChannel();

    /**
     * 应用绑定平台服务类性
     * @param appId
     * @param platformChannelCodes
     * @throws BusinessException
     */
    void bindPlatformChannelForApp(String appId, String platformChannelCodes) throws BusinessException;

    /**
     * 查询应用是否绑定某平台服务
     * @param appId
     * @param platformChannel
     * @return
     * @throws BusinessException
     */
    int queryAppBindPlatformChannel(String appId,String platformChannel) throws
            BusinessException;

    /**
     * 根据服务类型编码查询支付渠道列表
     * @param platformChannelCode  服务类型编码
     * @return
     * @throws BusinessException
     */
    List<PayChannelDTO> queryPayChannelByPlatformChannel(String platformChannelCode) throws
            BusinessException;

    /**
     * 保存支付渠道参数（拥有保存和更新能力）
     * @param payChannelParam
     * @throws BusinessException
     */
    void savePayChannelParam(PayChannelParamDTO payChannelParam) throws BusinessException;

    /**
     * 根据应用id和服务类型编码查询支付渠道参数
     * @param appId
     * @param platformChannel
     * @return
     * @throws BusinessException
     */
    List<PayChannelParamDTO> queryPayChannelParamByAppAndPlatform(String appId, String
            platformChannel)
            throws BusinessException;

    /**
     * 根据应用id和服务类型编码和支付渠道编码查询支付渠道参数
     * @param appId
     * @param platformChannel
     * @param payChannel
     * @return
     * @throws BusinessException
     */
    PayChannelParamDTO queryParamByAppPlatformAndPayChannel(String appId, String platformChannel,
                                                            String payChannel) throws BusinessException;
}
